Optimal. Leaf size=175 \[ \frac {a^3 (a B+4 A b) \log (\sin (c+d x))}{d}+\frac {b^2 \left (a^2 A+3 a b B+A b^2\right ) \tan (c+d x)}{d}-\frac {b^2 \left (6 a^2 B+4 a A b-b^2 B\right ) \log (\cos (c+d x))}{d}-x \left (a^4 A-4 a^3 b B-6 a^2 A b^2+4 a b^3 B+A b^4\right )+\frac {b (2 a A+b B) (a+b \tan (c+d x))^2}{2 d}-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^3}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.48, antiderivative size = 175, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 5, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.161, Rules used = {3605, 3647, 3637, 3624, 3475} \[ \frac {b^2 \left (a^2 A+3 a b B+A b^2\right ) \tan (c+d x)}{d}-\frac {b^2 \left (6 a^2 B+4 a A b-b^2 B\right ) \log (\cos (c+d x))}{d}-x \left (-6 a^2 A b^2+a^4 A-4 a^3 b B+4 a b^3 B+A b^4\right )+\frac {a^3 (a B+4 A b) \log (\sin (c+d x))}{d}+\frac {b (2 a A+b B) (a+b \tan (c+d x))^2}{2 d}-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^3}{d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3475
Rule 3605
Rule 3624
Rule 3637
Rule 3647
Rubi steps
\begin {align*} \int \cot ^2(c+d x) (a+b \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx &=-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^3}{d}+\int \cot (c+d x) (a+b \tan (c+d x))^2 \left (a (4 A b+a B)-\left (a^2 A-A b^2-2 a b B\right ) \tan (c+d x)+b (2 a A+b B) \tan ^2(c+d x)\right ) \, dx\\ &=\frac {b (2 a A+b B) (a+b \tan (c+d x))^2}{2 d}-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^3}{d}+\frac {1}{2} \int \cot (c+d x) (a+b \tan (c+d x)) \left (2 a^2 (4 A b+a B)-2 \left (a^3 A-3 a A b^2-3 a^2 b B+b^3 B\right ) \tan (c+d x)+2 b \left (a^2 A+A b^2+3 a b B\right ) \tan ^2(c+d x)\right ) \, dx\\ &=\frac {b^2 \left (a^2 A+A b^2+3 a b B\right ) \tan (c+d x)}{d}+\frac {b (2 a A+b B) (a+b \tan (c+d x))^2}{2 d}-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^3}{d}-\frac {1}{2} \int \cot (c+d x) \left (-2 a^3 (4 A b+a B)+2 \left (a^4 A-6 a^2 A b^2+A b^4-4 a^3 b B+4 a b^3 B\right ) \tan (c+d x)-2 b^2 \left (4 a A b+6 a^2 B-b^2 B\right ) \tan ^2(c+d x)\right ) \, dx\\ &=-\left (a^4 A-6 a^2 A b^2+A b^4-4 a^3 b B+4 a b^3 B\right ) x+\frac {b^2 \left (a^2 A+A b^2+3 a b B\right ) \tan (c+d x)}{d}+\frac {b (2 a A+b B) (a+b \tan (c+d x))^2}{2 d}-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^3}{d}+\left (a^3 (4 A b+a B)\right ) \int \cot (c+d x) \, dx+\left (b^2 \left (4 a A b+6 a^2 B-b^2 B\right )\right ) \int \tan (c+d x) \, dx\\ &=-\left (a^4 A-6 a^2 A b^2+A b^4-4 a^3 b B+4 a b^3 B\right ) x-\frac {b^2 \left (4 a A b+6 a^2 B-b^2 B\right ) \log (\cos (c+d x))}{d}+\frac {a^3 (4 A b+a B) \log (\sin (c+d x))}{d}+\frac {b^2 \left (a^2 A+A b^2+3 a b B\right ) \tan (c+d x)}{d}+\frac {b (2 a A+b B) (a+b \tan (c+d x))^2}{2 d}-\frac {a A \cot (c+d x) (a+b \tan (c+d x))^3}{d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] time = 1.02, size = 134, normalized size = 0.77 \[ \frac {-2 a^4 A \cot (c+d x)+2 a^3 (a B+4 A b) \log (\tan (c+d x))+2 b^3 (4 a B+A b) \tan (c+d x)+i (a+i b)^4 (A+i B) \log (-\tan (c+d x)+i)-(a-i b)^4 (B+i A) \log (\tan (c+d x)+i)+b^4 B \tan ^2(c+d x)}{2 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.63, size = 193, normalized size = 1.10 \[ \frac {B b^{4} \tan \left (d x + c\right )^{3} - 2 \, A a^{4} + {\left (B a^{4} + 4 \, A a^{3} b\right )} \log \left (\frac {\tan \left (d x + c\right )^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) \tan \left (d x + c\right ) - {\left (6 \, B a^{2} b^{2} + 4 \, A a b^{3} - B b^{4}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) \tan \left (d x + c\right ) + 2 \, {\left (4 \, B a b^{3} + A b^{4}\right )} \tan \left (d x + c\right )^{2} + {\left (B b^{4} - 2 \, {\left (A a^{4} - 4 \, B a^{3} b - 6 \, A a^{2} b^{2} + 4 \, B a b^{3} + A b^{4}\right )} d x\right )} \tan \left (d x + c\right )}{2 \, d \tan \left (d x + c\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 4.07, size = 195, normalized size = 1.11 \[ \frac {B b^{4} \tan \left (d x + c\right )^{2} + 8 \, B a b^{3} \tan \left (d x + c\right ) + 2 \, A b^{4} \tan \left (d x + c\right ) - 2 \, {\left (A a^{4} - 4 \, B a^{3} b - 6 \, A a^{2} b^{2} + 4 \, B a b^{3} + A b^{4}\right )} {\left (d x + c\right )} - {\left (B a^{4} + 4 \, A a^{3} b - 6 \, B a^{2} b^{2} - 4 \, A a b^{3} + B b^{4}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \, {\left (B a^{4} + 4 \, A a^{3} b\right )} \log \left ({\left | \tan \left (d x + c\right ) \right |}\right ) - \frac {2 \, {\left (B a^{4} \tan \left (d x + c\right ) + 4 \, A a^{3} b \tan \left (d x + c\right ) + A a^{4}\right )}}{\tan \left (d x + c\right )}}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.40, size = 242, normalized size = 1.38 \[ -A \,a^{4} x -\frac {A \cot \left (d x +c \right ) a^{4}}{d}-\frac {A \,a^{4} c}{d}+\frac {a^{4} B \ln \left (\sin \left (d x +c \right )\right )}{d}+\frac {4 A \,a^{3} b \ln \left (\sin \left (d x +c \right )\right )}{d}+4 B x \,a^{3} b +\frac {4 B \,a^{3} b c}{d}+6 A x \,a^{2} b^{2}+\frac {6 A \,a^{2} b^{2} c}{d}-\frac {6 a^{2} b^{2} B \ln \left (\cos \left (d x +c \right )\right )}{d}-\frac {4 a A \,b^{3} \ln \left (\cos \left (d x +c \right )\right )}{d}-4 B x a \,b^{3}+\frac {4 B \tan \left (d x +c \right ) a \,b^{3}}{d}-\frac {4 B a \,b^{3} c}{d}-A x \,b^{4}+\frac {A \tan \left (d x +c \right ) b^{4}}{d}-\frac {A \,b^{4} c}{d}+\frac {B \,b^{4} \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {b^{4} B \ln \left (\cos \left (d x +c \right )\right )}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.69, size = 164, normalized size = 0.94 \[ \frac {B b^{4} \tan \left (d x + c\right )^{2} - \frac {2 \, A a^{4}}{\tan \left (d x + c\right )} - 2 \, {\left (A a^{4} - 4 \, B a^{3} b - 6 \, A a^{2} b^{2} + 4 \, B a b^{3} + A b^{4}\right )} {\left (d x + c\right )} - {\left (B a^{4} + 4 \, A a^{3} b - 6 \, B a^{2} b^{2} - 4 \, A a b^{3} + B b^{4}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \, {\left (B a^{4} + 4 \, A a^{3} b\right )} \log \left (\tan \left (d x + c\right )\right ) + 2 \, {\left (4 \, B a b^{3} + A b^{4}\right )} \tan \left (d x + c\right )}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.44, size = 142, normalized size = 0.81 \[ \frac {\mathrm {tan}\left (c+d\,x\right )\,\left (A\,b^4+4\,B\,a\,b^3\right )}{d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )\,\left (B\,a^4+4\,A\,b\,a^3\right )}{d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (-B+A\,1{}\mathrm {i}\right )\,{\left (-b+a\,1{}\mathrm {i}\right )}^4}{2\,d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B+A\,1{}\mathrm {i}\right )\,{\left (b+a\,1{}\mathrm {i}\right )}^4}{2\,d}-\frac {A\,a^4\,\mathrm {cot}\left (c+d\,x\right )}{d}+\frac {B\,b^4\,{\mathrm {tan}\left (c+d\,x\right )}^2}{2\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 2.61, size = 289, normalized size = 1.65 \[ \begin {cases} \tilde {\infty } A a^{4} x & \text {for}\: c = 0 \wedge d = 0 \\x \left (A + B \tan {\relax (c )}\right ) \left (a + b \tan {\relax (c )}\right )^{4} \cot ^{2}{\relax (c )} & \text {for}\: d = 0 \\\tilde {\infty } A a^{4} x & \text {for}\: c = - d x \\- A a^{4} x - \frac {A a^{4}}{d \tan {\left (c + d x \right )}} - \frac {2 A a^{3} b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} + \frac {4 A a^{3} b \log {\left (\tan {\left (c + d x \right )} \right )}}{d} + 6 A a^{2} b^{2} x + \frac {2 A a b^{3} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} - A b^{4} x + \frac {A b^{4} \tan {\left (c + d x \right )}}{d} - \frac {B a^{4} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {B a^{4} \log {\left (\tan {\left (c + d x \right )} \right )}}{d} + 4 B a^{3} b x + \frac {3 B a^{2} b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} - 4 B a b^{3} x + \frac {4 B a b^{3} \tan {\left (c + d x \right )}}{d} - \frac {B b^{4} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {B b^{4} \tan ^{2}{\left (c + d x \right )}}{2 d} & \text {otherwise} \end {cases} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________